package cn.wolfcode.p2p.bussness.domain;

import cn.wolfcode.p2p.base.domain.BaseAuthDomain;
import cn.wolfcode.p2p.base.domain.BaseDomain;
import cn.wolfcode.p2p.base.domain.LoginInfo;
import com.alibaba.druid.support.json.JSONUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

//线下充值单
@Getter
@Setter
public class RechargeOffline extends BaseAuthDomain{
    private PlatformBankInfo bankInfo;//平台账户
    private String tradeCode;//交易号
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date rechargeDate;//交易日期
    private BigDecimal amount;//充值金额
    private String note;//备注信息
    public String getJsonString(){
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("id",super.getId());
        map.put("username",super.getApplier().getUsername());
        map.put("tradeCode",tradeCode);
        map.put("amount",amount);
        map.put("rechargeDate",new SimpleDateFormat("yyyy-MM-dd").format(rechargeDate));
        return JSONUtils.toJSONString(map);
    }
}
